Part Number Hot Search : 
UPD16818 MUR405PT 0N06L S0512 ACJ1212P HER1G6 IR2302 1R331M10
Product Description
Full Text Search
 

To Download AN1502 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  AN1502/0202 1/7 AN1502 application note emulated data eeprom with st7 hdflash memory by microcontroller division applications introduction when the data eeprom is not available in a st7 device, it can be emulated by the hdflash memory with some restrictions. this application note describes how to emulate this feature with a st72f521 device and the restrictions this emulation implies. data eeprom can be emulated in all hdflash devices. as hdflash is a dual voltage flash memory, the 12-volt programming voltage must be provided on the application board (a pull-down on icpsel on the application board is advised). for more information concerning st7 programming, a .zip file is included with the complete corresponding code for the st72f521, visit our web site at www.st.com . 1
2/7 emulated data eeprom with st7 hdflash memory 1 principle two different implementations can be distinguished: n assuming that it is possible to limit the data eeprom byte values to 00h..feh (as ffh is the default hdflash erased value), the principle of this emulation is to reserve n bytes in the hdflash for each emulated data eeprom byte which has to be cycled n times. with this solution ffh value can not be used. as shown in figure 1., a ptr pointer gives the access to the emulated data eeprom byte. C for a read operation, from ptr address, read the first data byte not equal to ffh to get the current value. C for a write operation, from ptr address, look for the last data byte equal to ffh and then write the new value at this location using the hdflash byte programming embedded command (same as iap method). figure 1. hdflash emulated data eeprom (value in 00h..feh) n assuming no limitation for the data eeprom byte values (00h..ffh), each byte value will need 2 byte locations. the first one will determine if it is the current value (example: 00h = current value, ffh = not yet used value) and the second one will contain the current byte value. so the principle of this emulation is to reserve 2xn bytes in the hdflash for each emulated data eeprom byte which has to be cycled n times. as shown in figure 2., a ptr pointer gives the access to the emulated data eeprom byte. C for a read operation, from ptr address, read the first data byte not equal to ffh (equal to 00h), the current value is the next adjacent byte. C for a write operation, from ptr address, look for the last data byte equal to ffh and then write the new value at this location and 00h in the previous location using the hdflash byte programming embedded command (same as iap method). in both methods, the programming is address decreasing, which means that when cu.0rrent value is found, the next byte to be programmed is the previous one (refer to diagrams). in the case of the st72f521r9 (biggest product) for instance, that means that if sectors 2 and 1 are empty (ffh), the first programmed byte will be at the last address of the sector 1 (efffh), because f000h is the first address of the sector 0 containing the user program (this sector is write protected in user mode). ffh ffh ... ffh ffh ... ffh val1 initial value ffh ffh ... ffh valm ... val2 val1 ptr ptr current value current value initial state ? m th state ? 2
3/7 emulated data eeprom with st7 hdflash memory figure 2. hdflash emulated data eeprom (value in 00h..ffh) 2 restrictions n only a few data eeprom bytes with a limited number of write/erase cycles can be emulated (these characteristics are directly linked to the needed memory space in hdflash) n emulated data eeprom must be located in sector 1 or 2 as sector 0 is write protected in user mode. C to use the embedded commands the rass protection must be disabled. so the protec- tion against unintentional access to the hdflash control register is no longer available. un- intentional programming is only guaranteed by the low probability of accidentally executing an embedded command with v pp at 12 volts. 3 advantage n the hdflash emulated data eeprom method can keep the data byte value history. ... ffh initial value ffh ... 00h valm ... ptr ptr current value current value initial state ? m th state ? ffh 00h val1 ffh ffh ffh ffh ffh ffh ffh ffh 00h val2 00h val1
4/7 emulated data eeprom with st7 hdflash memory 4 assembler program example the following program example describes a driver routine to be called to emulate data eeprom with a hdflash st7 device (data value limited to 00h..feh). this example assumes that all restrictions are taken into account. st7/ ;****************************************************************************** ; title: hddatae2emul.asm ; author: cmg_mcd application team ; description: data eeprom emulation with hdflash memory (st72f521 example) ;****************************************************************************** title "hddatae2emul.asm" bytes fcsr equ $29 ; hdflash control register definition flash_cmd equ $ff ; reserved ram area for hdflash embedded commands flash_sect equ $fe flash_ptrl equ $fd ; ptrh:ptrl is also used for read operation flash_ptrh equ $fc flash_endl equ $fb flash_endh equ $fa flash_data equ $f9 flash_freq equ $f8 #define freq 8 ; application frequency is 8mhz words segment word at 1000-dfff 'hdflash sect2' < memory location of the emulated data eeprom : from 8000h in this example > segment word at e000-efff 'hdflash sect1' < potential memory location for emulated data eeprom > segment word at f000-ffff 'hdflash sect0' ; < reset > ld a,#$56 ; enter rass keys to unlock fcr register ld fcr,a ld a,#$ae ld fcr,a ; < user application program > ld a, #$80 ; read emulated data eeprom value with a pointer ld flash_ptrh, a ; located at address 8000h (sector 2). ld a, #$00 ld flash_ptrh, a call hdemule2_byteread ; result: current value in a register ; < user application program > ld a, #$80 ; read emulated data eeprom value with a pointer
5/7 emulated data eeprom with st7 hdflash memory ld flash_ptrh, a ; located at address 8000h (sector 2). ld a, #$00 ld flash_ptrh, a ld a, #$55 ; 55h is the new data to be write in emulated data ld flash_data, a ; eeprom byte located at 8000h address call hdemule2_byteprog ; result: status returned in flash_cmd high nibble ; < user application program > ; ----------------------------------------------------------------------------- ; routine: hdemule2_byteread ; description: emulated data eeprom byte read driver routine ; before: flash_ptrh:l = pointer corresponding to the start address of the ; memory table allocated to the emulated data eeprom ; byte to read ; after: a = current emulated data eeprom byte value ; flash_ptrh:l = address of the current emulated data eeprom byte value ; ressources: ; program size: 15 bytes ; used ram area: 2 bytes for ptrh:ptrl. ; ----------------------------------------------------------------------------- .hdemule2_byteread ld a,[flash_ptrh.w] ; read emulated data eeprom table content cp a, #$ff ; if the value is ffh check next location jrne hdemule2_byteread_end ; else a = current value. inc flash_ptrl jrne hdemule2_byteread inc flash_ptrh jrt hdemule2_byteread .hdemule2_byteread_end ret ; ----------------------------------------------------------------------------- ; routine: hdemule2_byteprog ; description: emulated data eeprom byte programming driver routine ; before: flash_ptrh:l = pointer corresponding to the start address of the ; memory table allocated to the emulated data eeprom ; byte to update ; flash_data = data to be programmmed ; after: flash_cmd = status result of the programming (see embedded status ; return code definition of the embedded command) ; ressources: ; program size: 24 bytes ; used ram area: same as hdflash embedded command ; - 16 bytes from 00f0h to 00ffh ; - 116 byte stack ; (see dedicated chapter for more details) ; ----------------------------------------------------------------------------- .hdemule2_byteprog call hdemule2_byteread ; to look for the current value address cp a, flash_data ; if the data to be written is the same as jreq hdemule2_byteprog_end ; current one, skip programming tnz flash_ptrl ; set the new current value address jrne hdemule2_byteprog_next ; => previous current - 1 dec flash_ptrh .hdemule2_byteprog_next dec flash_ptrl clr flash_cmd ; set embedded command to "byte programming"
6/7 emulated data eeprom with st7 hdflash memory ld a,#freq ; set the cpu frequency ld flash_freq,a ld fcr,a ; launch the hdflash embedded command .hdemule2_byteprog_end ret ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ end
7/7 emulated data eeprom with st7 hdflash memory the present note which is for guidance only aims at providing customers with information regarding their products in order for them to save time. as a result, stmicroelectronics shall not be held liable for any direct, indirect or consequential damages with respect to any claims arising from the content of such a note and/or the use made by customers of the information contained herein in connexion with their products. information furnished is believed to be accurate and reliable. however, stmicroelectronics assumes no responsibility for the co nsequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. no license is granted by implication or otherwise under any patent or patent rights of stmicroelectronics. specifications mentioned in this publicati on are subject to change without notice. this publication supersedes and replaces all information previously supplied. stmicroelectronics prod ucts are not authorized for use as critical components in life support devices or systems without the express written approval of stmicroele ctronics. the st logo is a registered trademark of stmicroelectronics ? 2002 stmicroelectronics - all rights reserved. purchase of i 2 c components by stmicroelectronics conveys a license under the philips i 2 c patent. rights to use these components in an i 2 c system is granted provided that the system conforms to the i 2 c standard specification as defined by philips. stmicroelectronics group of companies australia - brazil - canada - china - finland - france - germany - hong kong - india - israel - italy - japan malaysia - malta - morocco - singapore - spain - sweden - switzerland - united kingdom - u.s.a. http://www.st.com


▲Up To Search▲   

 
Price & Availability of AN1502

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X